﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using WCF;
using System.ServiceModel.Description;

namespace WCFHost
{
    class Program
    {
        static void Main(string[] args)
        {
            ServiceHost showHost = new ServiceHost(typeof(ShowService));
            showHost.Open();
            
            ServiceHost bookingHost = new ServiceHost(typeof(BookingService));
            bookingHost.Open();

            ServiceHost movieHost = new ServiceHost(typeof(MovieService));
            movieHost.Open();

            ServiceHost customerHost = new ServiceHost(typeof(CustomerService));
            customerHost.Open();

            ServiceHost cinemaHost = new ServiceHost(typeof(CinemaHallService));
            cinemaHost.Open();

            Console.WriteLine("");
            Console.WriteLine("----- The following endpoints is available: -----");

            foreach (ServiceEndpoint se in showHost.Description.Endpoints)
            {
                Console.WriteLine(se.Address);
                Console.WriteLine(se.Binding.Name);
                Console.WriteLine(se.Contract.Name);
                Console.WriteLine();
            }
            foreach (ServiceEndpoint se in bookingHost.Description.Endpoints)
            {
                Console.WriteLine(se.Address);
                Console.WriteLine(se.Binding.Name);
                Console.WriteLine(se.Contract.Name);
                Console.WriteLine();
            }
            foreach (ServiceEndpoint se in movieHost.Description.Endpoints)
            {
                Console.WriteLine(se.Address);
                Console.WriteLine(se.Binding.Name);
                Console.WriteLine(se.Contract.Name);
                Console.WriteLine();
            }
            foreach (ServiceEndpoint se in customerHost.Description.Endpoints)
            {
                Console.WriteLine(se.Address);
                Console.WriteLine(se.Binding.Name);
                Console.WriteLine(se.Contract.Name);
                Console.WriteLine();
            }
            foreach (ServiceEndpoint se in cinemaHost.Description.Endpoints)
            {
                Console.WriteLine(se.Address);
                Console.WriteLine(se.Binding.Name);
                Console.WriteLine(se.Contract.Name);
                Console.WriteLine();
            }


            Console.WriteLine("");
            Console.WriteLine("Host is running - Press enter to end...");
            Console.ReadLine();
            
            showHost.Close();
            bookingHost.Close();
            movieHost.Close();
            customerHost.Close();
            cinemaHost.Close();

        }
    }
}
